﻿Imports System.Net
Imports System.Text
Imports System.IO

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Public Shared Function UnZip(ByVal value() As Byte) As String
        Dim mem2 As New IO.MemoryStream(value)
        Dim gz = New System.IO.Compression.GZipStream(mem2, IO.Compression.CompressionMode.Decompress)
        Dim sr As New IO.StreamReader(gz)
        Dim st = sr.ReadToEnd
        sr.Close()
        Return st
    End Function

    Public Shared Function PostData(ByVal url As String, ByVal value As String) As String

        Dim req As HttpWebRequest = WebRequest.Create(url)

        Dim buffer = Encoding.UTF8.GetBytes(value)

        req.Method = "POST"
        req.ContentType = "application/x-www-form-urlencoded"
        req.ContentLength = buffer.Length

        Dim reqst As Stream = req.GetRequestStream() '; // add form data to request stream
        reqst.Write(buffer, 0, buffer.Length)
        reqst.Flush()
        reqst.Close()
        Dim res As HttpWebResponse = req.GetResponse()
        Dim ckc As String = ""

        Using scc As New System.IO.StreamReader(res.GetResponseStream)
            ckc = scc.ReadToEnd
            scc.Close()
        End Using

        Return ckc
    End Function
End Class
